<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul>
        <li>123</li>
    </ul>
    <script>
        //创建元素 createElement
        var li = document.createElement('li');
        var li1 = document.createElement('li');
        li1.innerText = '999'
        li.innerHTML = '666';
        var ul = document.querySelector('ul');
        //添加元素节点 node.appendChild(child) 类似push
        ul.appendChild(li);
        //添加元素节点到指定元素的前面 node.insertBefore(child) 
        ul.insertBefore(li1, ul.children[0]);
    </script>
</body>

</html>